<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Phar</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.lzf-optimized-for.html">lzf_optimized_for</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="intro.phar.html">简介</a></div>
 <div class="up"><a href="refs.compression.html">压缩与归档扩展</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="book.phar" class="book">
 
 <h1 class="title">Phar</h1>
 
 
 
 
 
 







 







 





 





 





 



 



 



 



 



 



 



 




<ul class="chunklist chunklist_book"><li><a href="intro.phar.html">简介</a></li><li><a href="phar.setup.html">安装／配置</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="phar.requirements.html">需求</a></li><li><a href="phar.installation.html">安装</a></li><li><a href="phar.configuration.html">运行时配置</a></li><li><a href="phar.resources.html">资源类型</a></li></ul></li><li><a href="phar.constants.html">预定义常量</a></li><li><a href="phar.using.html">Using Phar Archives</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="phar.using.intro.html">Using Phar Archives: Introduction</a></li><li><a href="phar.using.stream.html">Using Phar Archives: the phar stream wrapper</a></li><li><a href="phar.using.object.html">Using Phar Archives: the Phar and PharData class</a></li></ul></li><li><a href="phar.creating.html">Creating Phar Archives</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="phar.creating.intro.html">Creating Phar Archives: Introduction</a></li></ul></li><li><a href="phar.fileformat.html">What makes a phar a phar and not a tar or a zip?</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="phar.fileformat.ingredients.html">Ingredients of all Phar archives, independent of file format</a></li><li><a href="phar.fileformat.stub.html">Phar file stub</a></li><li><a href="phar.fileformat.comparison.html">Head-to-head comparison of Phar, Tar and Zip</a></li><li><a href="phar.fileformat.tar.html">Tar-based phars</a></li><li><a href="phar.fileformat.zip.html">Zip-based phars</a></li><li><a href="phar.fileformat.phar.html">Phar File Format</a></li><li><a href="phar.fileformat.flags.html">Global Phar bitmapped flags</a></li><li><a href="phar.fileformat.manifestfile.html">Phar manifest file entry definition</a></li><li><a href="phar.fileformat.signature.html">Phar Signature format</a></li></ul></li><li><a href="class.phar.html">Phar</a> — The Phar class<ul class="chunklist chunklist_book chunklist_children"><li><a href="phar.addemptydir.html">Phar::addEmptyDir</a> — Add an empty directory to the phar archive</li><li><a href="phar.addfile.html">Phar::addFile</a> — Add a file from the filesystem to the phar archive</li><li><a href="phar.addfromstring.html">Phar::addFromString</a> — Add a file from the filesystem to the phar archive</li><li><a href="phar.apiversion.html">Phar::apiVersion</a> — Returns the api version</li><li><a href="phar.buildfromdirectory.html">Phar::buildFromDirectory</a> — Construct a phar archive from the files within a directory.</li><li><a href="phar.buildfromiterator.html">Phar::buildFromIterator</a> — Construct a phar archive from an iterator.</li><li><a href="phar.cancompress.html">Phar::canCompress</a> — Returns whether phar extension supports compression using either zlib or bzip2</li><li><a href="phar.canwrite.html">Phar::canWrite</a> — Returns whether phar extension supports writing and creating phars</li><li><a href="phar.compress.html">Phar::compress</a> — Compresses the entire Phar archive using Gzip or Bzip2 compression</li><li><a href="phar.compressallfilesbzip2.html">Phar::compressAllFilesBZIP2</a> — Compresses all files in the current Phar archive using Bzip2 compression</li><li><a href="phar.compressallfilesgz.html">Phar::compressAllFilesGZ</a> — Compresses all files in the current Phar archive using Gzip compression</li><li><a href="phar.compressfiles.html">Phar::compressFiles</a> — Compresses all files in the current Phar archive</li><li><a href="phar.construct.html">Phar::__construct</a> — Construct a Phar archive object</li><li><a href="phar.converttodata.html">Phar::convertToData</a> — Convert a phar archive to a non-executable tar or zip file</li><li><a href="phar.converttoexecutable.html">Phar::convertToExecutable</a> — Convert a phar archive to another executable phar archive file format</li><li><a href="phar.copy.html">Phar::copy</a> — Copy a file internal to the phar archive to another new file within the phar</li><li><a href="phar.count.html">Phar::count</a> — Returns the number of entries (files) in the Phar archive</li><li><a href="phar.createdefaultstub.html">Phar::createDefaultStub</a> — Create a phar-file format specific stub</li><li><a href="phar.decompress.html">Phar::decompress</a> — Decompresses the entire Phar archive</li><li><a href="phar.decompressfiles.html">Phar::decompressFiles</a> — Decompresses all files in the current Phar archive</li><li><a href="phar.delmetadata.html">Phar::delMetadata</a> — Deletes the global metadata of the phar</li><li><a href="phar.delete.html">Phar::delete</a> — Delete a file within a phar archive</li><li><a href="phar.extractto.html">Phar::extractTo</a> — Extract the contents of a phar archive to a directory</li><li><a href="phar.getmetadata.html">Phar::getMetadata</a> — Returns phar archive meta-data</li><li><a href="phar.getmodified.html">Phar::getModified</a> — Return whether phar was modified</li><li><a href="phar.getsignature.html">Phar::getSignature</a> — Return MD5/SHA1/SHA256/SHA512/OpenSSL signature of a Phar archive</li><li><a href="phar.getstub.html">Phar::getStub</a> — Return the PHP loader or bootstrap stub of a Phar archive</li><li><a href="phar.getsupportedcompression.html">Phar::getSupportedCompression</a> — Return array of supported compression algorithms</li><li><a href="phar.getsupportedsignatures.html">Phar::getSupportedSignatures</a> — Return array of supported signature types</li><li><a href="phar.getversion.html">Phar::getVersion</a> — Return version info of Phar archive</li><li><a href="phar.hasmetadata.html">Phar::hasMetadata</a> — Returns whether phar has global meta-data</li><li><a href="phar.interceptfilefuncs.html">Phar::interceptFileFuncs</a> — instructs phar to intercept fopen, file_get_contents, opendir, and all of the stat-related functions</li><li><a href="phar.isbuffering.html">Phar::isBuffering</a> — Used to determine whether Phar write operations are being buffered, or are flushing directly to disk</li><li><a href="phar.iscompressed.html">Phar::isCompressed</a> — Returns Phar::GZ or PHAR::BZ2 if the entire phar archive is compressed (.tar.gz/tar.bz and so on)</li><li><a href="phar.isfileformat.html">Phar::isFileFormat</a> — Returns true if the phar archive is based on the tar/phar/zip file format depending on the parameter</li><li><a href="phar.isvalidpharfilename.html">Phar::isValidPharFilename</a> — Returns whether the given filename is a valid phar filename</li><li><a href="phar.iswritable.html">Phar::isWritable</a> — Returns true if the phar archive can be modified</li><li><a href="phar.loadphar.html">Phar::loadPhar</a> — Loads any phar archive with an alias</li><li><a href="phar.mapphar.html">Phar::mapPhar</a> — Reads the currently executed file (a phar) and registers its manifest</li><li><a href="phar.mount.html">Phar::mount</a> — Mount an external path or file to a virtual location within the phar archive</li><li><a href="phar.mungserver.html">Phar::mungServer</a> — Defines a list of up to 4 $_SERVER variables that should be modified for execution</li><li><a href="phar.offsetexists.html">Phar::offsetExists</a> — determines whether a file exists in the phar</li><li><a href="phar.offsetget.html">Phar::offsetGet</a> — Gets a PharFileInfo object for a specific file</li><li><a href="phar.offsetset.html">Phar::offsetSet</a> — set the contents of an internal file to those of an external file</li><li><a href="phar.offsetunset.html">Phar::offsetUnset</a> — remove a file from a phar</li><li><a href="phar.running.html">Phar::running</a> — Returns the full path on disk or full phar URL to the currently executing Phar archive</li><li><a href="phar.setalias.html">Phar::setAlias</a> — Set the alias for the Phar archive</li><li><a href="phar.setdefaultstub.html">Phar::setDefaultStub</a> — Used to set the PHP loader or bootstrap stub of a Phar archive to the default loader</li><li><a href="phar.setmetadata.html">Phar::setMetadata</a> — Sets phar archive meta-data</li><li><a href="phar.setsignaturealgorithm.html">Phar::setSignatureAlgorithm</a> — set the signature algorithm for a phar and apply it.</li><li><a href="phar.setstub.html">Phar::setStub</a> — Used to set the PHP loader or bootstrap stub of a Phar archive</li><li><a href="phar.startbuffering.html">Phar::startBuffering</a> — Start buffering Phar write operations, do not modify the Phar object on disk</li><li><a href="phar.stopbuffering.html">Phar::stopBuffering</a> — Stop buffering write requests to the Phar archive, and save changes to disk</li><li><a href="phar.uncompressallfiles.html">Phar::uncompressAllFiles</a> — Uncompresses all files in the current Phar archive</li><li><a href="phar.unlinkarchive.html">Phar::unlinkArchive</a> — Completely remove a phar archive from disk and from memory</li><li><a href="phar.webphar.html">Phar::webPhar</a> — mapPhar for web-based phars. front controller for web applications</li></ul></li><li><a href="class.phardata.html">PharData</a> — The PharData class<ul class="chunklist chunklist_book chunklist_children"><li><a href="phardata.addemptydir.html">PharData::addEmptyDir</a> — Add an empty directory to the tar/zip archive</li><li><a href="phardata.addfile.html">PharData::addFile</a> — Add a file from the filesystem to the tar/zip archive</li><li><a href="phardata.addfromstring.html">PharData::addFromString</a> — Add a file from the filesystem to the tar/zip archive</li><li><a href="phardata.buildfromdirectory.html">PharData::buildFromDirectory</a> — Construct a tar/zip archive from the files within a directory.</li><li><a href="phardata.buildfromiterator.html">PharData::buildFromIterator</a> — Construct a tar or zip archive from an iterator.</li><li><a href="phardata.compress.html">PharData::compress</a> — Compresses the entire tar/zip archive using Gzip or Bzip2 compression</li><li><a href="phardata.compressfiles.html">PharData::compressFiles</a> — Compresses all files in the current tar/zip archive</li><li><a href="phardata.construct.html">PharData::__construct</a> — Construct a non-executable tar or zip archive object</li><li><a href="phardata.converttodata.html">PharData::convertToData</a> — Convert a phar archive to a non-executable tar or zip file</li><li><a href="phardata.converttoexecutable.html">PharData::convertToExecutable</a> — Convert a non-executable tar/zip archive to an executable phar archive</li><li><a href="phardata.copy.html">PharData::copy</a> — Copy a file internal to the phar archive to another new file within the phar</li><li><a href="phardata.decompress.html">PharData::decompress</a> — Decompresses the entire Phar archive</li><li><a href="phardata.decompressfiles.html">PharData::decompressFiles</a> — Decompresses all files in the current zip archive</li><li><a href="phardata.delmetadata.html">PharData::delMetadata</a> — Deletes the global metadata of a zip archive</li><li><a href="phardata.delete.html">PharData::delete</a> — Delete a file within a tar/zip archive</li><li><a href="phardata.extractto.html">PharData::extractTo</a> — Extract the contents of a tar/zip archive to a directory</li><li><a href="phardata.iswritable.html">PharData::isWritable</a> — Returns true if the tar/zip archive can be modified</li><li><a href="phardata.offsetset.html">PharData::offsetSet</a> — set the contents of a file within the tar/zip to those of an external file or string</li><li><a href="phardata.offsetunset.html">PharData::offsetUnset</a> — remove a file from a tar/zip archive</li><li><a href="phardata.setalias.html">PharData::setAlias</a> — dummy function (Phar::setAlias is not valid for PharData)</li><li><a href="phardata.setdefaultstub.html">PharData::setDefaultStub</a> — dummy function (Phar::setDefaultStub is not valid for PharData)</li><li><a href="phardata.setmetadata.html">Phar::setMetadata</a> — Sets phar archive meta-data</li><li><a href="phardata.setsignaturealgorithm.html">Phar::setSignatureAlgorithm</a> — set the signature algorithm for a phar and apply it.  The</li><li><a href="phardata.setstub.html">PharData::setStub</a> — dummy function (Phar::setStub is not valid for PharData)</li></ul></li><li><a href="class.pharfileinfo.html">PharFileInfo</a> — The PharFileInfo class<ul class="chunklist chunklist_book chunklist_children"><li><a href="pharfileinfo.chmod.html">PharFileInfo::chmod</a> — Sets file-specific permission bits</li><li><a href="pharfileinfo.compress.html">PharFileInfo::compress</a> — Compresses the current Phar entry with either zlib or bzip2 compression</li><li><a href="pharfileinfo.construct.html">PharFileInfo::__construct</a> — Construct a Phar entry object</li><li><a href="pharfileinfo.decompress.html">PharFileInfo::decompress</a> — Decompresses the current Phar entry within the phar</li><li><a href="pharfileinfo.delmetadata.html">PharFileInfo::delMetadata</a> — Deletes the metadata of the entry</li><li><a href="pharfileinfo.getcrc32.html">PharFileInfo::getCRC32</a> — Returns CRC32 code or throws an exception if CRC has not been verified</li><li><a href="pharfileinfo.getcompressedsize.html">PharFileInfo::getCompressedSize</a> — Returns the actual size of the file (with compression) inside the Phar archive</li><li><a href="pharfileinfo.getmetadata.html">PharFileInfo::getMetadata</a> — Returns file-specific meta-data saved with a file</li><li><a href="pharfileinfo.getpharflags.html">PharFileInfo::getPharFlags</a> — Returns the Phar file entry flags</li><li><a href="pharfileinfo.hasmetadata.html">PharFileInfo::hasMetadata</a> — Returns the metadata of the entry</li><li><a href="pharfileinfo.iscrcchecked.html">PharFileInfo::isCRCChecked</a> — Returns whether file entry has had its CRC verified</li><li><a href="pharfileinfo.iscompressed.html">PharFileInfo::isCompressed</a> — Returns whether the entry is compressed</li><li><a href="pharfileinfo.iscompressedbzip2.html">PharFileInfo::isCompressedBZIP2</a> — Returns whether the entry is compressed using bzip2</li><li><a href="pharfileinfo.iscompressedgz.html">PharFileInfo::isCompressedGZ</a> — Returns whether the entry is compressed using gz</li><li><a href="pharfileinfo.setcompressedbzip2.html">PharFileInfo::setCompressedBZIP2</a> — Compresses the current Phar entry within the phar using Bzip2 compression</li><li><a href="pharfileinfo.setcompressedgz.html">PharFileInfo::setCompressedGZ</a> — Compresses the current Phar entry within the phar using gz compression</li><li><a href="pharfileinfo.setmetadata.html">PharFileInfo::setMetadata</a> — Sets file-specific meta-data saved with a file</li><li><a href="pharfileinfo.setuncompressed.html">PharFileInfo::setUncompressed</a> — Uncompresses the current Phar entry within the phar, if it is compressed</li></ul></li><li><a href="class.pharexception.html">PharException</a> — The PharException class<ul class="chunklist chunklist_book chunklist_children"><li><a href="pharexception.intro.unused.html">PharException</a> — The PharException class provides a phar-specific exception class
    for try/catch blocks.</li></ul></li></ul></div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.lzf-optimized-for.html">lzf_optimized_for</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="intro.phar.html">简介</a></div>
 <div class="up"><a href="refs.compression.html">压缩与归档扩展</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
